/*
	Copyright (C) 2011 Simas Toleikis

	This file is part of Die2Nite Agent.

	Die2Nite Agent is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

"use strict";

// NOTE: Inserting CSS this way will not require any extra permissions (like "tabs")
function injectCSS(stylesheet) {

	var stylesheetElement = document.createElement("link");

	stylesheetElement.setAttribute("rel", "stylesheet");
	stylesheetElement.setAttribute("type", "text/css");
	stylesheetElement.setAttribute("href", chrome.extension.getURL(stylesheet));

	document.documentElement.appendChild(stylesheetElement);
}

// Add content mode stylesheets
chrome.extension.sendRequest({type: "getContentMode"}, function(msg) {

	// Compact Mode
	if (msg.compactMode) {
		injectCSS("css/compactMode.css?2");
	}

	// Expert Mode
	if (msg.expertMode) {
		injectCSS("css/expertMode.css?2");
	}
});